<template>
  <div class="store-selector">
    <el-select
      style="width:100%;"
      v-model="form"
      filterable
      remote
      reserve-keyword
      :remote-method="getData">
      <el-option :value="undefined" label="全部" v-if="showAll"/>
      <el-option v-for="item in list" :key="item.value" :label="item.value" :value="item.key"/>
    </el-select>
  </div>
</template>

<script>
import vModelMixins from '../mixins/vModelMixins'

export default {
  name: 'DbSelector',
  mixins: [vModelMixins],
  props: {
    value: {},
    showAll: { type: Boolean, default: true },
    type: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      list: []
    }
  },
  methods: {
    //企业类型:10 企业性质:11 执业类型:13 学历:34
    getData(search) {
      // /platform/getStaterNums.do
      this.lAxios({
        method: 'post', //方法
        url: '/platform/getStaterNums.do', //路径，基础路径在main.js里面配置
        params: {
          //传参
          id: this.type
        }
      })
        .then(res => {
          //成功的回调函数
          this.list = res.data.data
        })
        .catch(err => {
          //失败的回调函数
          console.log(err)
        })
    }
  },
  mounted() {
    this.getData()
  }
}
</script>

<style scoped>
</style>